<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<title>Nuvoton ESensor Demo Page</title>
		<link rel="icon" type="image/x-ico" href="../img/nuvoton.ico" />
		<link rel="shortcut icon" type="image/x-icon" href="../img/nuvoton.ico" />
		<link type="text/css" href="../jquery/css/redmond/jquery-ui-custom.min.css" rel="stylesheet">
		<script type="text/javascript" src="../jquery/js/jquery.min.js"></script>
		<script type="text/javascript" src="../jquery/js/jquery-ui-custom.min.js"></script>
		<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
		<script type="text/javascript" src="js/nuvoton.js"></script>
		<script type="text/javascript" src="js/videoParam.js"></script>
		
		<script type="text/javascript">
		//<![CDATA[
			var	varViewType		= "jpeg",
				varViewPipe		= 0;
			var FrameIndex		= 0;
			var FrameCnt		= 0;
			
			$.ajaxSetup({
				type: "POST",
				headers: { "cache-control": "no-cache" }
			});
			
			$.ajaxSetup({
				type: "GET",
				headers: { "cache-control": "no-cache" }
			});
			
			function UpdateImageSrc()
			{
				if($.getUrlVar("solution") != "snapshot")
				{
					$("#video").prop("src", "/image.snapshot?frame=" + FrameIndex);
					FrameIndex = FrameIndex + 1;
					FrameCnt = FrameCnt + 1;
				}
			}
			
			function RefreshFPS()
			{
				$("#info_fps").html(Math.round(FrameCnt / (varShortTimeout / 1000)));
				FrameCnt = 0;
				setTimeout("RefreshFPS()", 5000); 
			}
			
			$.extend({
				getUrlVars: function(){
					var vars = [], hash;
					var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
					for(var i = 0; i < hashes.length; i++)
					{
						hash = hashes[i].split('=');
						vars.push(hash[0]);
						vars[hash[0]] = hash[1];
					}
					return vars;
				},
				getUrlVar: function(name){
					return $.getUrlVars()[name];
				}
			});
			
			verifiedUser = verifyUser();
		
			if(verifiedUser == "")
				window.top.location.href = "/";
			
			$(document).ready(function(e){
				_setBrowser();
				varViewPipe = $.getUrlVar("pipe");
				CreateVideoParam("tagResol", "tagQuality", null, varViewType, varViewPipe);
				CreateVideoStatus("tagStatus", true, false, false, true);
				RefreshStatus("", false, false, false, true);
				CreateVideoExt("tagZoom", "tagVideoCtrl", "tagRecFileList", varViewType, varViewPipe);
				
				if(!$.browser.mobile || confirm("This page would transfer huge data through network, would yoy like to continue?"))
					RefreshFPS();
			});
			
		//]]>
		</script>
	</head>
	
	<body>
		<div id="Info-Dialog"></div>
		<table>
			<tr cellpadding="0">
				<td><div class="ParamName">Resolution</div></td>
				<td><div id="tagResol"></div></td>
				<td rowspan="2">
					<div id="tagStatus"></div>
				</td>
			</tr>
			<tr>
				<td><div class="ParamName">Quality</div></td>
				<td><div id="tagQuality"></div></td>
			</tr>
			<tr>
				<td><div class="ParamName">Digital-Zoom</div></td>
				<td><div id="tagZoom"></div></td>
				<td>
					<span id="tagVideoCtrl"></span>
					<span id="tagRecFileList"></span>
				</td>
			</tr>
		</table>
		<hr>
		<table>
			<tr>
				<td>
					<iframe id="video_ctrl" frameborder="0" width="0" height="0">Your browser does not support iframe tag.</iframe>
				</td>
				<td>
					<img id="video" src="/image.snapshot" onload="UpdateImageSrc()" />
				</td>
			</tr>
		</table>
		<hr>
	</body>
</html>
